---
title: YugabyteDB
sidebarTitle: YugabyteDB
---

This is the implementation of the YugabyteDB data handler for MindsDB.

[YugabyteDB](https://www.yugabyte.com/) is a high-performance, cloud-native distributed SQL database that aims to support all PostgreSQL features. It is best fit for cloud-native OLTP (i.e. real-time, business-critical) applications that need absolute data correctness and require at least one of the following: scalability, high tolerance to failures, or globally-distributed deployments.

## Prerequisites

Before proceeding, ensure the following prerequisites are met:

1. Install MindsDB [locally via Docker](https://docs.mindsdb.com/setup/self-hosted/docker) or use [MindsDB Cloud](https://cloud.mindsdb.com/).
2. To connect YugabyteDB to MindsDB, install the required dependencies following [this instruction](/setup/self-hosted/docker#install-dependencies).
3. Install or ensure access to YugabyteDB.

## Implementation

This handler is implemented using `psycopg2`, a Python library that allows you to use Python code to run SQL commands on the YugabyteDB database.

The required arguments to establish a connection are as follows:

- `user` is the database user.
- `password` is the database password.
- `host` is the host name, IP address, or URL.
- `port` is the port used to make TCP/IP connection.
- `database` is the database name.
- `schema` is the schema to which your table belongs.

## Usage

In order to make use of this handler and connect to the YugabyteDB database in MindsDB, the following syntax can be used:

```sql
CREATE DATABASE yugabyte_datasource
WITH
    engine = 'yugabyte',
    parameters = {
        "user": "admin",
        "password": "1234",
        "host": "127.0.0.1",
        "port": 5433,
        "database": "yugabyte",
        "schema": "your_schema_name"
    };
```

You can use this established connection to query your table as follows:

```sql
SELECT *
FROM yugabyte_datasource.demo;
```

<Note>
NOTE : If you are using YugabyteDB Cloud with MindsDB Cloud website you need to add below 3 static IPs of MindsDB Cloud to `allow IP list` for accessing it publicly.
```
18.220.205.95
3.19.152.46
52.14.91.162
```
![public](https://github-production-user-asset-6210df.s3.amazonaws.com/75653580/238903548-1b054591-f5db-4a6d-a3d0-d048671e4cfa.png)
</Note>
